package com.palazzisoft.balonpie.dao;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

import src.com.palazzisoft.balonpie.util.Pair;

import com.palazzisoft.balonpie.entities.User;

@Component
public class UserDao {

	private Map<String, Pair<String, String>> users;

	public UserDao() {
		users = new HashMap<String, Pair<String, String>>();
		users.put("pablo", new Pair<String, String>("1234", "ROLE_USER"));
		users.put("gerbio", new Pair<String, String>("1234", "ROLE_USER"));
		users.put("admin", new Pair<String, String>("1234", "ROLE_ADMIN"));
	}

	public User getUser(String user) {
		if (users.containsKey(user)) {
			return new User(user, users.get(user).getFirst(), users.get(user).getSecond());
		}

		return null;
	}
}
